﻿//==============================================================================  
//Copyright (C) 2012-2015 9UN.ORG. All rights reserved. 
//GUID：46172595-6b69-4526-b9da-426d663f5b05
//CLR Version: 4.0.30319.18033
//Code Author：Kevin Wang
//Contact：Email(Admin@9un.org),QQ(265382 or 74344)
//Filename：MediaLibraryFactory
//Namespace：RuanRang.Media.Core
//Functions：MediaLibraryFactory  
//Created by Kevin Wang at 2013/2/2 23:05:09 http://blog.9un.org
//============================================================================== 

#region Usings

using System;
using System.Collections.Generic;

#endregion

namespace RuanRang.Media.Core.Io
{
    /// <summary>
    /// Container for player's output parameters.
    /// </summary>
    public sealed class PlayerOutput
    {
        /// <summary>
        /// Creates player output without window, which can be used to transcode or streaming.
        /// </summary>
        public PlayerOutput()
        {

        }

        /// <summary>
        /// Creates player output with custom sout mrl.
        /// </summary>
        /// <param name="soutMrl">
        /// A <see cref="System.String"/> which defines custom sout mrl. Please refer to vlc documentation for more information.
        /// </param>
        public PlayerOutput(string soutMrl)
        {
            _soutMrl = soutMrl;
        }

        /// <summary>
        /// Creates player with duplicated output to window.
        /// </summary>
        /// <param name="window">Window where rendering goes.</param>
        /// <exception cref="ArgumentNullException"><see cref="_window"/> parameter is null.</exception>
        public PlayerOutput(NativeMediaWindow window)
        {
            if (window == null)
            {
                throw new ArgumentNullException("window");
            }
            //
            _window = window;
        }

        private readonly string _soutMrl;

        /// <summary>
        /// Mrl used to initialize --sout. All other parameters are ignored in case if this is not null or empty.
        /// </summary>
        public string OutMrl
        {
            get
            {
                return (_soutMrl);
            }
        }

        private readonly NativeMediaWindow _window;
        /// <summary>
        /// Window where video is rendered. Can be null.
        /// </summary>
        public MediaWindow Window
        {
            get
            {
                return (_window as MediaWindow);
            }
        }

        /// <summary>
        /// Window where video is rendered. Can be null. 
        /// </summary>
        public NativeMediaWindow NativeWindow
        {
            get
            {
                return (_window);
            }
        }

        private readonly List<OutFile> _files = new List<OutFile>();
        /// <summary>
        /// List of file output objects.
        /// </summary>
        public IList<OutFile> Files
        {
            get
            {
                return (_files);
            }
        }

        private readonly List<OutputNetworkStream> _networkStreams = new List<OutputNetworkStream>();
        /// <summary>
        /// List of network output objects.
        /// </summary>
        public IList<OutputNetworkStream> NetworkStreams
        {
            get
            {
                return (_networkStreams);
            }
        }

        /// <summary>
        /// Is output window specified.
        /// </summary>
        public bool IsWindowDefined
        {
            get
            {
                return (_window != null);
            }
        }
    }
}